package Logic;

import java.util.ArrayList;
import java.util.Collections;

public class PokerGame1 {


//    准备牌  只一次即可，用static{}

    static ArrayList<String> list=new ArrayList<>();
    static{
        String []sign={"♥","♠","♣","♦"};
        String []num={"3","4","5","6","7","8","9","10","J","Q","K","A","2"};
        for (String value : sign) {
            for (String s : num) {
                list.add(value + s);
            }
        }
        list.add("小王");
        list.add("大王");
    }

    public PokerGame1(){
        //洗牌
        Collections.shuffle(list);
        //发牌
        ArrayList<String>lord=new ArrayList<>();

        ArrayList<String>player1=new ArrayList<>();
        ArrayList<String>player2=new ArrayList<>();
        ArrayList<String>player3=new ArrayList<>();

        for (int i = 0; i < list.size(); i++) {
            if(i>=list.size()-3){
                lord.add(list.get(i));
            }
            else {
                if (i % 3 == 0) {
                    player1.add(list.get(i));
                } else if (i % 3 == 1) {
                    player2.add(list.get(i));
                } else {
                    player3.add(list.get(i));
                }
            }

        }
        //看牌
        look(player1,"1");
        look(player2,"2");
        look(player3,"3");
        look(lord,"底牌");

    }

    public static void look(ArrayList<String> list,String name) {
        System.out.print(name+":");
        for (String s : list) {
            System.out.print(s+" ");
        }
        System.out.println();
    }


}
